﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CallObject.aspx.cs" Inherits="LearnJquery.CallObject" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="js/jquery-1.4.1-vsdoc.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p>
            one</p>
        <p id="two">
            two</p>
        <p>
            three</p>
        <p>
            four</p>
    </div>

    <input type="button" value="each" onclick="javascript:$('p').each(function (i) { this.innerText += i; })" />
    <input type="button" value="size" onclick="javascript:alert($('p').size())" />
    <input type="button" value="length" onclick="javascript:alert($('p').length)" />
    <input type="button" value="selector" onclick="javascript:alert($('p').selector)" />
    <input type="button" value="context" onclick="javascript:alert($('p').context)" />
    <input type="button" value="get" onclick="javascript:jqueryGet()" />
    <input type="button" value="index" onclick="javascript:jqueryIndex()" />
    <script type="text/javascript">
        function jqueryGet() {
            alert($("p").get(0).innerHTML);
        }

        function jqueryIndex() { 
            alert($("p").index($("#two")));
        }
    </script>
    </form>
</body>
</html>
